﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ITOMMS.Entity;

namespace ITOMMS.Web.AssetManage
{
    public partial class AssetView : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["id"] != null)
                {
                    VwAssetEntity asset = new Entity.VwAssetEntity();
                    asset = asset.FindEntity("ID=" + int.Parse(Request.QueryString["id"]));
                    if (asset != null)
                    {
                        tbUserEntity user = new tbUserEntity().FindEntity("id=" + asset.customerID.ToString() + "");
                        lblCompany.Text = user.CompanyName;
                        lblAssetNo.Text = asset.AssetNo;
                        lblAssetClassName.Text = asset.ClassName;
                        lblAssetName.Text = asset.AssetName;
                        lblAssetStateName.Text = asset.StateName;
                        lblInvoiceNo.Text = asset.InvoiceNo;
                        lblLinkMan.Text = asset.LinkMan;
                        lblMadeName.Text = asset.MadeName;
                        lblPrincipal.Text = asset.Principal;
                        if (asset.PurchaseDate != null)
                        {
                            lblPurchaseDate.Text = asset.PurchaseDate.Value.ToShortDateString();
                        }
                        lblPurchaseMoney.Text = asset.PurchaseMoney.ToString();
                        lblSaler.Text = asset.SalerName;
                        txtAssetDescription.Text = asset.AssetDescription;
                    }

                }
            }
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            Response.Redirect("AssetList.aspx", true);
        }
    }
}
